package com.hzd.sms;

import ablaze.framework.sms.SMSException;
import ablaze.framework.sms.SMSSender;
import ablaze.framework.utils.HttpUtils;
import ablaze.framework.utils.MapUtils;
import org.springframework.stereotype.Component;

/**
 * @author christ
 * @date 2015/11/2
 */
@Component
public class DefaultSMSSender implements SMSSender {

    //url
    private static final String URI = "http://222.73.117.158/msg/HttpBatchSendSM";
    //账户
    private static final String ACCOUNT = "huzhudai";
    //密码
    private static final String PSWD = "Huzhudai123";
    //是否需要状态报告
    private static final String NEEDSTATUS = "true";
    //订购的产品ID
    private static final String PRODUCT = null;
    //自定义扩展码（3位）
    private static final String EXTNO = null;


    @Override
    public void send(String mobile, String content) throws SMSException {

        HttpUtils.post(URI, MapUtils.toMap(
                "account", ACCOUNT,
                "pswd", PSWD,
                "mobile", mobile,
                "needstatus", NEEDSTATUS,
                "msg", content
        ));
    }
}
